<template>
  <div class="person">
    <ul>
      <li v-for="l in list" :key="l.id">{{ l.name }}-{{ l.age }}</li>
    </ul>
  </div>
</template>

<script lang="ts" setup>
import { defineProps, withDefaults } from "vue";
import {
  type PersonInter,
  type Persons,
} from "d:/demo01/vite-project/src/types";
//只接收
// let x = defineProps(["a", "list"]);
// console.log(x.list);

//接收list+限制类型
// defineProps<{ list: Persons }>();

//接收 + 限制类型 + 限制必要性 + 指定默认值
withDefaults(defineProps<{ list?: Persons }>(), {
  list: () => [{ id: "114514", name: "田所浩二", age: 19 }],
});

// let person: PersonInter = { id: "iwdfgwafbwa", name: "nnnn", age: 232 };
//泛型：
//干净的前提：在ts里面写好
</script>

<style scoped></style>
